package com.calenda.setevent.adapter;

import java.util.ArrayList;

import com.calenda.setevent.R;
import com.calenda.setevent.entity.EventEntity;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ListEventAdapter extends BaseAdapter{
	private ArrayList<EventEntity> arrData;
	private LayoutInflater inflater;
	private Context context;
	
	public ListEventAdapter(Context context,ArrayList<EventEntity> arrData) {
		inflater = LayoutInflater.from(context);
		this.arrData = arrData;
		this.context = context;
	}

	@Override
	public int getCount() {
		return arrData.size();
	}

	@Override
	public EventEntity getItem(int arg0) {
		return arrData.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		return 0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
//		TextView textView = new TextView(context);
//		textView.setText("1234");
		if(arg1 == null){
			arg1 = inflater.inflate(R.layout.event_item1, null);
		}
		TextView tvTime = (TextView)arg1.findViewById(R.id.tvTime);
		TextView tvDes = (TextView)arg1.findViewById(R.id.tvDes);
		tvTime.setText(arrData.get(arg0).getTime());
		tvDes.setText(arrData.get(arg0).getDes());
		return arg1;
	}

}
